# Author:	gong_libin
# Date:		2017_11_01

CC = g++
CFLAGS = -g -Wall
CFLAGS += -D_CM_DEBUG_

CM_ENV = $(shell pwd)
CM_BIN = $(CM_ENV)/bin
CM_INC = $(CM_ENV)/inc
CM_SRC = $(CM_ENV)/src

CM_GLIB = /usr/lib64
CM_ELIB = /usr/local/lib
CM_KLIB = /usr/local/lib
CM_RLIB = /usr/local/lib
CM_GINC = /usr/include/CmInc

export CC
export CFLAGS

export CM_ENV
export CM_BIN
export CM_INC
export CM_SRC

export CM_GLIB
export CM_ELIB
export CM_KLIB
export CM_RLIB
export CM_GINC

.PHONY: bin src test

all: bin src test

bin:
	if test -d $(CM_BIN); then true; else mkdir $(CM_BIN); fi;

src:
	$(MAKE) -C $(CM_SRC)/utils
	$(MAKE) -C $(CM_SRC)/adx
	$(MAKE) -C $(CM_SRC)/dsp
	$(MAKE) -C $(CM_SRC)/ssp

test:
	$(MAKE) -C test

clean:
	$(MAKE) clean -C $(CM_SRC)/utils
	$(MAKE) clean -C $(CM_SRC)/adx
	$(MAKE) clean -C $(CM_SRC)/dsp
	$(MAKE) clean -C $(CM_SRC)/ssp
	$(MAKE) clean -C test
	rm -rf $(CM_BIN)
